﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QLBN
{
    public partial class frmdangnhap : Form
    {
        private String _username;

        public String Username
        {
            get { return _username; }
            set { _username = value; }
        }
        private int _role;

        public int Role
        {
            get { return _role; }
            set { _role = value; }
        }

        public frmdangnhap()
        {
            InitializeComponent();
        }

        private Boolean _status;

        public Boolean Status
        {
            get { return _status; }
            set { _status = value; }
        }

        private void btnexit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void frmdangnhap_Load(object sender, EventArgs e)
        {

        }

        private void btnok_Click(object sender, EventArgs e)
        {
            DangNhap dn = new DangNhap();
            //String username = dn.Kiem_tra_dang_nhap(this.txtusername.Text, this.txtpass.Text);
            _status = dn.Kiem_tra_dang_nhap(this.txtusername.Text, this.txtpass.Text);
            if (_status == true)
            {
                _username = dn.Username;
                _role = dn.Role;
                this.Close();
            }
            else
            {
                MessageBox.Show("Đăng nhập không thành công", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }


    }
}
